import datetime
import os
import logging

from models import *
from google.appengine.ext import db
from google.appengine.api import users

class BookService:
	def getBookForISBN(self,isbn):
		return Book.gql("WHERE isbn = :1",isbn).get()
		
	def createBook(self, _name, _author, _isbn):
		book = Book(name = _name, author = _author, isbn = _isbn)
		book.put()
		return book
		
	def clear(self):
		books = db.GqlQuery("SELECT * FROM Book")
		for book in books:
			book.delete()